<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../../include/publicMeta.jsp"%>

<article class="cl pd-20">
    <form action="/config/addPermission" method="post" class="form form-horizontal" id="form-admin-add" target="_parent" onsubmit="return validatePermissionForm()">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>权限名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入权限名称" id="name" name="name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>权限描述：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="" placeholder="请输入权限描述" id="desc_" name="desc_">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>权限对应的 URL：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="" placeholder="请输入权限对应的 URL" id="url" name="url">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>
<%@include file="../../include/publicFooter.jsp"%>

<script type="text/javascript">
    function validatePermissionForm() {
        var name = document.getElementById("name").value.trim();
        var desc_ = document.getElementById("desc_").value.trim();
        var url = document.getElementById("url").value.trim();

        if (name === "") {
            alert("权限名称不能为空");
            document.getElementById("name").focus();
            return false;
        }

        if (desc_ === "") {
            alert("权限描述不能为空");
            document.getElementById("desc_").focus();
            return false;
        }

        if (url === "") {
            alert("权限对应的 URL 不能为空");
            document.getElementById("url").focus();
            return false;
        }

        return true;
    }

    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>
